/*
 * CargarArchivo.java
 * 0.2 09/11/2012
 *
 * Authors: José Luis Urbano Orgaz (joseluislikebetter@hotmail.com)
 *          Milagros Membrillo Jimenez
 *
 * Copyright: This file is part of E-Man.
 *   
 *   E-Man is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *  
 *   E-Man is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU General Public License for more details.
 *  
 *   You should have received a copy of the GNU General Public License
 *   along with E-Man.  If not, see <http://www.gnu.org/licenses/>.
 */

package EntradaSalida;

import Objetos.ConexionBD;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author José Luis Urbano Orgaz
 */
public class CargarArchivo implements Serializable{
    
    public ConexionBD Conexion()
    {
      ConexionBD conexion=null;
      String ruta="datos/conexion.data";
      try {
        ObjectInputStream entrada;  
        entrada = new ObjectInputStream(new FileInputStream(ruta));  
        conexion=(ConexionBD)entrada.readObject();
        entrada.close();
      } catch (ClassNotFoundException ex) {
        System.out.println("Error al cargar el archivo: Clase no encontrada");
        Logger.getLogger(CargarArchivo.class.getName()).log(Level.SEVERE, null, ex);
      } catch (IOException ex) {
        System.out.println("Error al cargar el archivo: Error de E/S");
        Logger.getLogger(CargarArchivo.class.getName()).log(Level.SEVERE, null, ex);
      }
      return conexion;
    }
}